Skip to main content

API & Database Reference

This document provides a detailed overview of NAVIGO’s database structure, API endpoints, and authentication rules.

Note: All protected endpoints require a valid Firebase Authentication token.


Database Structure

NAVIGO uses Firebase Firestore as the primary database. Below is a summary of the main collections and their fields:

1. Users Collection

  • Collection: users
  • Document ID: userId
  • Fields:
    • email (string) – User email address
    • name (string) – Full name
    • points (number) – Accumulated points from completing quests

2. Quests Collection

  • Collection: quests
  • Document ID: questsId
  • Fields:
    • title (string) – Quest title
    • description (string) – Quest description
    • building (string) – Associated building or location
    • rewardPoints (number) – Points awarded upon completion
    • status (string) – Quest status (active or completed)
    • createdAt (timestamp) – Quest creation time
    • updatedAt (timestamp) – Last update time

3. Collectibles Collection

  • Collection: collectibles
  • Document ID: collectiblesId
  • Fields:
    • name (string) – Name of the badge or item
    • description (string) – Brief description of the collectible
    • iconUrl (string) – URL for the collectible icon

4. Leaderboards Collection

  • Collection: leaderboards
  • Document ID: leaderboardsId
  • Fields:
    • ranks (array) – List of user scores and rankings

Authentication

NAVIGO uses Firebase Authentication to manage user sign-up and sign-in. Users can register with:

  • Email & Password
  • Google Sign-In (optional)

Password Requirements

Users cannot complete registration until the password meets all requirements:

  • Minimum length: 8 characters
  • Maximum length: 30 characters
  • Must include:
    • At least one uppercase character
    • At least one lowercase character
    • At least one numeric character
    • At least one special character

If a user attempts to sign up with a non-compliant password, registration will fail, and they must update their password to meet the policy.


Example API Endpoints (Reference)

Quests

  • POST /api/quests – Create a new quest
  • GET /api/quests – Retrieve all quests
  • PUT /api/quests/:id – Update quest details
  • DELETE /api/quests/:id – Delete a quest

Collectibles

  • POST /api/collectibles – Add a new badge or item
  • GET /api/collectibles – Get all collectibles
  • PUT /api/collectibles/:id – Update a collectible
  • DELETE /api/collectibles/:id – Remove a collectible

Leaderboard

  • GET /api/leaderboard – Fetch leaderboard standings
  • PUT /api/leaderboard/:userId – Update a player’s score

Location Verification

  • POST /api/location/verify – Confirm user reached a quest location

This structure ensures clarity, security, and real-time tracking of quests, rewards, and player progress in NAVIGO.